package team.headnurse.nursemanagement.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import team.headnurse.nursemanagement.dao.SchedulingReferenceDao;
import team.headnurse.nursemanagement.model.SchedulingReference;
import team.headnurse.nursemanagement.service.SchedulingReferenceService;

import javax.annotation.Resource;

/**
 * @author Eugene-Forest
 */
@Transactional(rollbackFor = Exception.class)
@Service
public class SchedulingReferenceServiceImpl implements SchedulingReferenceService {

    @Resource
    private SchedulingReferenceDao schedulingReferenceDao;

    /**
     * 插入一条排班基准表的记录
     *
     * @param schedulingReference 排班基准对象
     * @return 如果成功则返回数字1
     */
    @Override
    public int insert(SchedulingReference schedulingReference) {
        return schedulingReferenceDao.insert(schedulingReference);
    }

    /**
     * 通过id删除一条排班基准记录
     *
     * @param departmentId 科室/部门id
     * @return 如果成功则返回数字1
     */
    @Override
    public int deleteById(String departmentId) {
        return schedulingReferenceDao.deleteById(departmentId);
    }

    /**
     * 更新一条排班基准记录
     *
     * @param schedulingReference 排班基准对象
     * @return 如果成功则返回数字1
     */
    @Override
    public int update(SchedulingReference schedulingReference) {
        return schedulingReferenceDao.update(schedulingReference);
    }

    /**
     * 通过id查找一个部门/科室的排班基准记录
     *
     * @param departmentId 科室/部门id
     * @return 如果成功则返回排班基准对象
     */
    @Override
    public SchedulingReference selectById(String departmentId) {
        return schedulingReferenceDao.selectById(departmentId);
    }
}
